YAHOO.namespace("ajaxstack");
YAHOO.ajaxstack.isTests = new YAHOO.tool.TestCase({

	name: "is Tests",

	//--------------------------------------------- 
	// Setup and tear down 
	//---------------------------------------------

	setUp: function()
	{
	},

	tearDown: function()
	{
	},

	//--------------------------------------------- 
	// Tests
	//---------------------------------------------

	testIsEmpty: function()
	{
		Assert.isTrue(is.Empty());
		Assert.isTrue(is.Empty(""));
		var a = {};
		Assert.isTrue(is.Empty(a['b']));

		Assert.isFalse(is.Empty(-1));
		Assert.isFalse(is.Empty(0));
		Assert.isFalse(is.Empty(1));
	},

	testIsInteger: function()
	{
		Assert.isTrue(is.Integer(-2000000000));
		Assert.isTrue(is.Integer(-1));
		Assert.isTrue(is.Integer(0));
		Assert.isTrue(is.Integer(1));
		Assert.isTrue(is.Integer(2000000000));
	},

	testIsInteger_withStrings: function()
	{
		Assert.isTrue(is.Integer("-1"));
		Assert.isTrue(is.Integer("0"));
		Assert.isTrue(is.Integer("1"));
	},

	testIsInteger_withFloats: function()
	{
		Assert.isFalse(is.Integer(-.1));
		Assert.isFalse(is.Integer(0.1));
		Assert.isFalse(is.Integer(1.1));
	},

	testIsDigit: function()
	{
		Assert.isTrue(is.Digit(0));
		Assert.isTrue(is.Digit(1));
		Assert.isTrue(is.Digit(2));

		Assert.isTrue(is.Digit("0"));
		Assert.isTrue(is.Digit("1"));
		Assert.isTrue(is.Digit("2"));

		Assert.isFalse(is.Digit(-1));
		Assert.isFalse(is.Digit(-11));
		Assert.isFalse(is.Digit(11));
	},

	testIsIntegerInRange: function()
	{
		Assert.isTrue(is.IntegerInRange(1, -2000000000, 2000000000));
		Assert.isTrue(is.IntegerInRange(0, -1, 1));
		Assert.isTrue(is.IntegerInRange(1, -1, 1));
		Assert.isTrue(is.IntegerInRange(1, 1, 31));
		Assert.isTrue(is.IntegerInRange(1979, 1000, 2000));
	},

	testIsIntegerInRange_string: function()
	{
		//crazy bug: http://www.faqts.com/knowledge_base/view.phtml/aid/8108/fid/53
		//conclusion always include radix/base
		Assert.isTrue(is.IntegerInRange(parseInt("09", 10), 1, 31));
		Assert.isTrue(is.IntegerInRange(parseInt("05", 10), 1, 12));
	}

});

